startAJAX = function(theDiv, module, op, dataPost, nPage){
	getList(theDiv, module, op, dataPost, nPage);
	setClick(theDiv, module, op, dataPost);
}

// 分页点击事件
setClick = function(theDiv, module, op, dataPost){
	$(theDiv + ' .BPbar a').livequery("click", function(){
		page = getPage(this);
		if (page != 0){getList(theDiv, module, op, dataPost, page);}
	});
}

// 页码初始化
setPage = function(theDiv){
	$(theDiv + ' .BPbar a').attr('href', '#');
	$(theDiv + ' .BPbar input').hide();
}

// 取得列表
getList = function (theDiv, module, op, dataPost, nPage){
	gLoadingMake('set');
	var urlPost = 'index.php?module=' + module + '&op=' + op;
	$.ajax({
		type:"GET",
		url: urlPost+"&page="+nPage,
		data:dataPost,
		success:function(msg){
			gLoadingMake('del');
			$(theDiv).html(msg);
			setPage(theDiv);
		}
	});
}

// 取得目标页码
getPage = function(thisS){// this, 每页数
	var page = 0;
	if ($(thisS).attr('class') != 'BPtotal'){
		var sNum = $(thisS).html();
		var pageNum = 10;//显示的页码数
		var thisPage = Number(getThisPage());
		var pageTotal =  Number($('.BPbar .BPside[title="最末页"]').html());
		if (sNum == '‹'){page = thisPage - 1;}
		else if (sNum == '‹‹'){
			if ((thisPage - pageNum) > 0){page = thisPage - pageNum;
			}else{page = 1;}
		}else if (sNum == '›'){page = thisPage + 1;
		}else if (sNum == '››'){
			if ((thisPage + pageNum) > pageTotal){page = (pageTotal == null) ? thisPage : pageTotal;}
			else{page = thisPage + pageNum;}
		}else{page = sNum;}
	}
	return page;
}
// 取得当前页的页码
getThisPage = function(){
	return $('.BPbar .BPcur').html();
}